package com.ylfstu;

/**
 * @author:Joy_Yang
 * @date:2022/9/26
 * @version:1.0
 */
public class Homework08 {
    public static void main(String[] args) {
        Color.RED.show();
        Color.BLUE.show();
        Color.BLACK.show();
        Color.GREEN.show();
        Color color1 = Color.YELLOW;

        switch (color1){
            case RED -> {
                System.out.println("匹配到红色...");
                break;
            }
            case BLUE -> {
                System.out.println("匹配到蓝色...");
                break;
            }
            //......
        }
    }
}
interface If1{
    void show();
}
enum Color implements If1{
    RED(255, 0, 0),
    BLUE(0, 0, 255),
    BLACK(0, 0, 0),
    YELLOW(255, 255, 0),
    GREEN(0, 255, 0);
    private int redValue;
    private int greenValue;
    private int blueValue;

    Color(int redValue, int greenValue, int blueValue) {
        this.redValue = redValue;
        this.greenValue = greenValue;
        this.blueValue = blueValue;
    }

    public int getRedValue() {
        return redValue;
    }

    public int getGreenValue() {
        return greenValue;
    }

    public int getBlueValue() {
        return blueValue;
    }

    @Override
    public void show() {
        System.out.println("RedValue=" + redValue
                + " GreenValue=" + greenValue + " BlueValue=" + blueValue);
    }
}
